package com.summer.shopping.config;

import com.summer.shopping.interceptor.InBoundInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    private InBoundInterceptor inBoundInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(inBoundInterceptor)
                .addPathPatterns("/**")          // 拦截所有路径
                .excludePathPatterns("/user/login","/user/regist")
                .excludePathPatterns("/product/**")
                .excludePathPatterns("/error")
                .excludePathPatterns("/shop/chat")
                .excludePathPatterns("/category/page","/secondary/**","/banner/list");

    }
}
